# -*- coding: utf-8 -*-

import csv
from zipfile import ZipFile
from StringIO import StringIO
import os
#
# def alexa():
#     D = Downloader()
#     zipped_data = D('http://s3.amazonaws.com/alexa-static/top-1m.csv.zip')
#     urls = [] # top 1 million URL's will be stored in this list
#     with ZipFile(StringIO(zipped_data)) as zf:
#         csv_filename = zf.namelist()[0]
#         for _, website in csv.reader(zf.open(csv_filename)):
#             urls.append('http://' + website)
#     return urls


def alexa():
    path = os.path.abspath('../top-1m.csv')
    url = []
    with open(path) as csvfile:
        reader = csv.reader(csvfile)
        for row in reader:
            url.append('http://'+row[1])
    return url

if __name__ == '__main__':
    print len(alexa())
